#pragma once

enum eDirectoryState
{
	eDS_Empty = 0,
	eDS_ChildOccupied,
	eDS_Occupied
};

struct sDirectory
{
	std::string m_szDirectory;
	int			m_nState;
	HTREEITEM	m_hTreeItem;
};

class CModuleVersionFileDirectoryWindow : public CWindowBase
{

public:
	CModuleVersionFileDirectoryWindow();
	virtual ~CModuleVersionFileDirectoryWindow();

	bool Create(HINSTANCE hInstance,HWND hParentWnd,UINT nChildID);
	void Release();

	void Clear();

	sDirectory* FindDirectory(LPCTSTR path);
	sDirectory* InsertDirectory(LPCTSTR path);
	sDirectory* FindParentDirectory(LPCTSTR path);
	
	int		GetDirectoryCount(){ return m_DirectoryMap.size();}

	void		UpdateDirectoryState(sDirectory* pDirectory);

	void		ClearDirectoryState();

protected:
	HIMAGELIST	m_hImageList;

	typedef stdext::hash_map<std::string,sDirectory*>	DIRECTORY_MAP;
	DIRECTORY_MAP	m_DirectoryMap;

	bool GetParentDirectory(LPCTSTR path, char* parent_path, int nSizeOfBuf);
	bool GetDirName(LPCTSTR path,char* name, int nSizeOfBuf);

protected:
	HTREEITEM InsertItem( LPCTSTR szItem,HTREEITEM hParent = TVI_ROOT,DWORD dwParam = 0,int imageIndex = 0,int selimageIndex = 0);

};